package abcy.cloud.authenticationserver.config.details.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.ClientRegistrationException;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;

import javax.sql.DataSource;

public class ClientDetailsServiceImpl implements ClientDetailsService {

    @Autowired
    private DataSource dataSource;
    @Override
    public ClientDetails loadClientByClientId(String s) throws ClientRegistrationException {
        JdbcClientDetailsService jdbcClientDetailsService = new JdbcClientDetailsService(dataSource);
        ClientDetails clientDetails = jdbcClientDetailsService.loadClientByClientId(s);
        return clientDetails;
    }
}
